<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="/resource/UserPwoer.tld" prefix="p"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	pageContext.setAttribute("userPwoer", request.getSession().getAttribute("userPwoer"));
%>
<c:set var="path" value="${pageContext.request.contextPath }" />
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>首页</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">

<script type="text/javascript"
	src="${path }/resource/js/jquery-2.1.4.min.js"></script>
<script type="text/javascript"
	src="${path }/resource/js/systools/DDMBase.js"></script>

<link rel="stylesheet"
	href="${path }/resource/weixin/css/house-list.css">
<link rel="stylesheet" href="${path }/resource/weixin/css/index.css">

</head>
<body>
	<!-- 头部 -->
	<header data-am-widget="header" class="am-header back-y">
		<div class="am-header-left am-header-nav">
			<a href="${path }/index" class=""> <img
				src="${path }/resource/images/logo.png">
				 <%-- <img
				src="${path }/resource/images/logo-font2.png" class="font-img"> --%>
			</a>
		</div>
		<div class="am-header-right am-header-nav">
			<input type="search" placeholder="找房子" onclick="javasrcript:location.href='${path }/visitor/redirect/house-list?fyGq=出售'" class="search-input">
			<i class="am-icon-search color-9"></i>
		</div>
	</header>
	<!-- 内容 -->
	<div class="content-main">
		<!-- 广告轮播 -->
		<div data-am-widget="slider" class="am-slider am-slider-a1"
			data-am-slider='{&quot;directionNav&quot;:false}'>
			<ul class="am-slides">
				<c:forEach var="item" items="${syhdp }" >
				<li><a href="${item.url }"><img src="${item.image }"></a></li>
				</c:forEach>
			</ul>
		</div>
		<!-- 房屋信息 -->
		<div class="back-w">
			<%-- <div class="float-l msg-div">
				<c:if test="${user eq null}">
						<a class="color-y" href="${path }/visitor/redirect/login" ><img alt="" class="index-img" src="${path }/resource/images/personal.png">&nbsp;登录</a>
				</c:if>
				<c:if test="${user ne null}">
					<a href="${path }/customer/redirect/personal" class="color-y"><img alt="" class="index-img" src="${path }/resource/images/personal.png">&nbsp;个人中心</a>
				</c:if>
				
			</div>
			<div class="float-r ad-div">
				<a class="color-y" href="${path }/customer/redirect/house-class"><img alt="" class="index-img" src="${path }/resource/images/fabu2.png">&nbsp;发布信息</a>
			</div> --%>

			<div class="title font-w6 color-y ">
				<ul class="am-avg-sm-5 title-ul back-w " style="padding:0">
			  	 <li class="text-center "><a href="${path }/visitor/redirect/house-list?fyGq=出售" class="color-3 font-size">出售</a></li>
				 <li class="text-center "><a href="${path }/visitor/redirect/house-list?fyGq=出租" class="color-3">出租</a></li>
			  	 <li class="text-center "><a href="${path }/visitor/redirect/house-list?fyGq=求购" class="color-3">求购</a></li>
			  	 <li class="text-center "><a href="${path }/visitor/redirect/house-list?fyGq=求租" class="color-3">求租</a></li>
			  	 <li class="text-center "><a href="${path }/visitor/redirect/house-list?fyKinds=新房&fyGq=出售" class="color-3">一手房</a></li>	  				
  				</ul>  
			</div>
			<!-- 房产列表 -->
			<div data-am-widget="list_news"
				class="am-list-news am-list-news-default">
					<!--图片广告-->
					<div class="banner-img padding-not ">
				<a href="${sygg.url }"><img alt="" src="${sygg.image}"></a>
			</div>
				
				
				<!--待用-->
				<%-- <div class="am-list-news-bd">
					<ul class="am-list">			
					<c:forEach var="item" items="${djdzk }" >
					<li class="am-g am-list-item-desced am-list-item-thumbed am-list-item-thumb-left">
							<div class="am-u-sm-4 am-list-thumb">
								<a href="${item.url }" class="" > <img src="${item.image }" /> </a>
							</div>

							<div class=" am-u-sm-8 am-list-main">
								<h3 class="am-list-item-hd">
									<a href="${item.url }" class="color-3 font-w6">${item.message }</a>
								</h3>
								<div class="am-list-item-text color-9">
									${item.remark }
								</div>
								
							</div>
						</li>
					</c:forEach>
					</ul>
				</div> --%>
				<div>
					<ul  class="am-avg-sm-2 title-ul2 back-w ">
						<c:forEach var="item" items="${djdzk }" >
						<li class=" ">
							<div class=" ">
								<a href="${item.url }" > <img  class="home-img"src="${item.image }" /> </a>
							</div>
							<div class="  ">
								<div class="show-1 text-center ">
									<a  href="${item.url }" class="color-3 font-w6">${item.message }</a>
								</div>
								<div class="text-center  show-1 ">
									<a  href="${item.url }"  class="color-3 font-w6">${item.remark }</a>
								</div>
							</div>
						</li>
					</c:forEach>
					
					</ul>
				</div>

			</div>
			<!--图片广告-->
			<c:forEach items="${sygg2 }" var="item" >
						<div class="banner-img padding-1 back-e">
							<a href="${item.url }"><img alt="" src="${item.image}"></a>
						</div>	
					</c:forEach>
			
			
			<div data-am-widget="list_news"
				class="am-list-news am-list-news-default">
				<!--列表标题-->
				<div class="am-list-news-bd" style="font-size: 1.6rem;" >
					<ul class="am-list" id="fyBox" >
				<%-- <c:forEach var="item" items="${newFy }" >
					<li class="am-g am-list-item-desced am-list-item-thumbed am-list-item-thumb-left">
							<div class="am-u-sm-4 am-list-thumb">
								<a href="${path }/index/queryFyMsg?id=${item.id }" class="" > <img src="${item.fyImage }" /> </a>
							</div>
							<div class=" am-u-sm-8 am-list-main">
								<h3 class="am-list-item-hd">
									<a href="${path }/index/queryFyMsg?id=${item.id }" class="color-3 font-w6">${item.fyTitle }</a>
								</h3>
								<div style="font-size: 1.5rem;"  class="am-list-item-text color-9">
									${item.infoNeighbourhoodsName } ${item.infoAddress }
									<span class="color-y font-w6 font-s1  price">
									<c:if test="${!empty item.csPrice }">${item.csPrice }万</c:if>
									<c:if test="${!empty item.czPrice }">${item.czPrice }元/月</c:if>
								</span>
								</div>
								<c:set value="${fn:split(item.qzqgTs, ',') }" var="tss" />
								<div class="am-list-item-text color-9">
									<c:forEach items="${tss }" var="ts">
										<span class="am-badge am-badge-warning">${ts }</span>
									</c:forEach>
								</div>
							</div>
						</li>
					</c:forEach> --%>
					</ul>
					<button id="addhas" class="addbtn" onclick="addData()"
					style="display: none;">加载更多</button>
				<button id="addno" class="addbtn" style="display: none;">已到底部</button>
				</div>
			</div>
			
			
			
		</div>
	</div>
	<!--foot-->
	  <div data-am-widget="navbar" class="am-navbar am-cf am-navbar-default back-y "
      id="">
      <ul class="am-navbar-nav am-cf am-avg-sm-4 back-y">
          <li >
           <c:if test="${user eq null}">
            <a href="${path }/visitor/redirect/login" class="">
                <img src="${path }/resource/images/personal.png" />
                <span class="am-navbar-label color-y">登陆</span>
            </a>
            </c:if>
            <c:if test="${user ne null}">
            <a href="${path }/customer/redirect/personal" class="">
            	<img src="${path }/resource/images/personal.png" />
                <span class="am-navbar-label color-y">个人中心</span>
            </a>
            </c:if>
            
            
          </li>
          <li >
            <a href="${path }/customer/redirect/house-class" class="">
                <img src="${path }/resource/images/fabu2.png"/>
                <span class="am-navbar-label color-y">发布信息</span>
            </a>
          </li>
         
          
      </ul>
  </div>
  
  <script type="text/javascript">
  
  $(function(){
	  addData();
	 
	  
  });
  
  
  
  
	var pageSize=10;
	var pageNow = 0;
	function addData(){
		$.AjaxProxy({p:{offset:10*pageNow}}).invoke(basePath+"/indexFy" , function(loj){
			builderDate(loj);
			pageNow++;
		});
	}
	
	
	
	
	 function builderDate(loj) {
		var html = "";
		if (loj.getRowCount() <= 0) {
			$("#addhas").hide();
			$("#addno").show();
			return;
		} else {
			$("#addhas").show();
			$("#addno").hide();
		}
		var html="";
		var price="";
		var top="";
		for (var i = 0; i < loj.getRowCount(); i++) {
			if(loj.getString(i,"csPrice").length>0){
				price=loj.getString(i,"csPrice")+"万";
			}else{
				price=loj.getString(i,"czPrice")+"元/月";
			}
			if(loj.getString(i,"glIsTop")=='是'){
				top='<img src="'+basePath+'/resource/images/d.png" />';
			}
			var strs=loj.getString(i,"qzqgTs").split(" ");
			var flag="";
			for(var j=0;j<strs.length;j++){
				flag+='<span class="am-badge am-badge-warning">'+strs[j]+'</span> ';
			}
			
			html+='<li class="am-g am-list-item-desced am-list-item-thumbed am-list-item-thumb-left">'+
				'<div class="am-u-sm-4 am-list-thumb">'+
			'<a href="${path }/index/queryFyMsg?id='+loj.getString(i,"id")+'" class="" > <img src="'+loj.getString(i,"fyImage")+'" /> </a>'+
		'</div>'+
		'<div class=" am-u-sm-8 am-list-main">'+
			'<h3 class="am-list-item-hd">'+
		'		<a href="${path }/index/queryFyMsg?id='+loj.getString(i,"id")+'" class="color-3 font-w6">'+loj.getString(i,"fyTitle")+'</a>'+top+
			'</h3>'+
		'	<div style="font-size: 1.5rem;"  class="am-list-item-text color-9">'+
		'		'+loj.getString(i,"infoAreaCount")+"㎡ */*层 "+loj.getString(i,"infoZxqk")+
		'		<span class="color-y font-w6 font-s1  price">'+price+
		'	</span>'+
		'	</div>'+
		'	<div class="am-list-item-text color-9">'+flag+'</div>'+
		'</div>'+
	'</li>'
		}
		$("#fyBox").append(html);
	}
  
  </script>
  
</body>
</html>
